local t = Def.ActorFrame{};

--[[t[#t+1] = Def.Quad { -- keep screen on!
	InitCommand=function(self) self:diffusealpha(0):sleep(5) end;
};]]

t[#t+1] = Def.ActorFrame { -- Color
		Def.Quad {
			InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffuse,color("#473D35");diffusebottomedge,color("#24201D"););
			StartCommand=cmd(diffusealpha,0;smooth,0.4;diffusealpha,1;);
			FinishCommand=cmd(smooth,0.5;diffusealpha,0;);
		};
};

t[#t+1] = LoadActor("_imagespawn")..{
	StartCommand=function(self) self:sleep(1.5):queuecommand("Play") end;
	PlayCommand=function(self) self:play() end;
};
t[#t+1] = Def.ActorFrame {
	StartCommand=function(self) self:diffusealpha(1) end;
	FinishCommand=function(self) self:smooth(0.5):diffusealpha(0) end;
	Def.Sprite {
		name="SongFrame";
		InitCommand=function(self) self:Center():addy(30):diffusealpha(0) end;
		StartCommand=function(self) self:sleep(0.3):decelerate(0.5):addy(-30):diffusealpha(1) end;
		FinishCommand=function(self) self:smooth(0.5):diffusealpha(0):linear(0.1):addy(30) end;
		BeforeLoadingNextCourseSongMessageCommand=function(self) 
			local song = SCREENMAN:GetTopScreen():GetNextCourseSong();
				if song then
					if song:HasJacket() then
						self:Load(THEME:GetPathG("", "_jacketframe")):scaletoclipped(256,256)
					elseif song:HasBanner() then
						self:Load(THEME:GetPathG("", "_commonbannerframe")):scaletoclipped(256,80)
					else
						self:Load(THEME:GetPathG("Common fallback", "banner")):scaletoclipped(256,80)
					end
				else
					self:diffusealpha(0)
				end
		end;
	};

	Def.Sprite {
		name="SongJacket";
		InitCommand=cmd(diffusealpha,1.0;zoom,0.7);
		StartCommand=cmd(Center;diffusealpha,0;sleep,1.8;diffusealpha,1;sleep,2);
		BeforeLoadingNextCourseSongMessageCommand=function(self) 
			local song = SCREENMAN:GetTopScreen():GetNextCourseSong(); 
				if song then
					if song:HasJacket() then
						self:Load(song:GetJacketPath()):scaletoclipped(253,253)
					elseif song:HasBanner() then
						self:Load(song:GetBannerPath()):scaletoclipped(253,77)
					else
						self:Load(THEME:GetPathG("Common fallback", "banner")):scaletoclipped(253,253)
					end
				else
					self:diffusealpha(0)
				end
		end;
	};
	
	Def.Quad { -- white square; power
		InitCommand=function(self) self:Center():draworder(5):zoomx(0):zoomy(1):diffuse(color("#FFFFFF")):diffusealpha(1) end;
		StartCommand=function(self) self:sleep(1.6):linear(0.1):zoomx(253):linear(0.1):zoomy(253):linear(0.3):diffusealpha(0) end;
		BeforeLoadingNextCourseSongMessageCommand=function(self) self:Center():draworder(5):zoomx(0):zoomy(1):diffuse(color("#FFFFFF")):diffusealpha(1) end;
};
};
--[[t[#t+1] = Def.ActorFrame {
	InitCommand=function(self) self:diffusealpha(0) end;
	BeforeLoadingNextCourseSongMessageCommand=function(self)
		local song = SCREENMAN:GetTopScreen():GetNextCourseSong(); 
			if song then
				if song:HasJacket() then
					Def.Quad { -- white square; power
						InitCommand=function(self) self:Center():zoomx(0):zoomy(1):diffuse(color("#FFFFFF")):diffusealpha(1) end;
						StartCommand=function(self) self:sleep(1.6):linear(0.1):zoomx(160):linear(0.1):zoomy(160):linear(0.3):diffusealpha(0) end;
					};
				elseif song:HasBanner() then
					Def.Quad { -- white square; power
						InitCommand=function(self) self:Center():zoomx(0):zoomy(1):diffuse(color("#FFFFFF")):diffusealpha(1) end;
						StartCommand=function(self) self:sleep(1.6):linear(0.1):zoomx(300):linear(0.1):zoomy(93):linear(0.3):diffusealpha(0) end;
					};
				else
					Def.Quad { -- white square; power
						InitCommand=function(self) self:Center():zoomx(0):zoomy(1):diffuse(color("#FFFFFF")):diffusealpha(1) end;
						StartCommand=function(self) self:sleep(1.6):linear(0.1):zoomx(300):linear(0.1):zoomy(93):linear(0.3):diffusealpha(0) end;
					};
				end
			else
				self:diffusealpha(0)
			end
	end;
};]]


return t;